
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人中心-{{$SEO['title']}}</title>
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <!--公用css引用-->
            @include('front.common.style')
            <!--END/公用css引用-->
    <link rel="stylesheet" href="../dist/css/userCenter.css">
</head>
<body>

<!--公共头部-->
@include('front.common.header')

        <!--END/公共头部-->

<div class="inbox user-center">
    <div class="layout-margin unend">
        <div class="sidebar-end"></div>
        <div class="sidebar-start">
            @include('front.common.leftnav')
        </div>
        <!--主体部分-->
        <div class="container">

            <!--用户信息-->
            <div class="container-inner">
                <div class="content-1 u-zone">
                    <div class="head-wrap fn-fl">
                        <img class="head-img fn-fl" src="../images/def-head.png" alt="">
                        <div class="con">
                            <p class="font-14">{{$user->user_name}}</p>
                            <span class="text-color-4">账号安全：</span>
                            <div class="bl-progress bl-progress-striped fn-dib">
                                <div class="bl-progress-bar progress-bar-success" style="width: 80%;"></div>
                            </div>
                            <a href="/my/account_safe" class="text-color-success">较高</a>
                        </div>
                    </div>

                    <ul class="ui-cols-3 u-welfare-list">
                        <li class="col"><a href="/my/order"><i class="icon icon-zone1"></i><span class="fn-db">我的订单</span></a></li>
                        <li class="col"><a href="/my/address"><i class="icon icon-zone2"></i><span class="fn-db">我的收货地址</span></a></li>
                        {{--<li class="col"><a href="#"><i class="icon icon-zone3"></i><span class="fn-db">我的福袋</span></a></li>--}}
                    </ul>
                </div>


            </div>
            <!--END/用户信息-->
@inject('pictureService','App\Interfaces\PictureService')
@inject('orderService','App\Interfaces\OrderService')
@inject('shopService','App\Interfaces\ShopService')
@inject('goodsService','App\Interfaces\GoodsService')
@inject('goodsService','App\Interfaces\GoodsService')
            <div class="container-inner layout-margin unstart fn-mt20">
                <div class="sidebar-end panel-group">
                    <!--推荐-->
                    <?php $similarGoods = $goodsService->getRandomGoods(2);//dd($similarGoods);?>
                    <div class="ui-brd-box1">
                        <div class="tit-3 tit-skin-2">
                            <p class="h">根据您的浏览为您推荐：</p>
                        </div>
                        <ul class="bl-imglist bl-imglist-hor">
                            @if($similarGoods)
                            @foreach($similarGoods as $key=>$value)
                            <li>
                                <a href="/goods/{{$value->goods_id}}" target="_blank" title="{{$value->goods_name}}">
                                    <img style="width: 218px;height: 218px;" class="img-lazyload lazy" data-src="@if($value->goods_thumb){{$pictureService->thumb($value->goods_thumb, 254, 254)}} @else # @endif" alt="">
                                </a>
                                <div class="con">
                                    <span class="text-color-1 font-18">￥{{$value->shop_price}}</span><del class="text-color-7 font-14 fn-ml10">￥{{$value->market_price}}</del>
                                    <p class="sub-tit fn-dib-otw" title="{{$value->goods_name}}">{{$value->goods_name}}</p>
                                </div>
                            </li>
                            @endforeach
                            @endif
                        </ul>
                    </div>
                    <!--END/推荐-->
                </div>

                <div class="sidebar-start"></div>


                <!--内部中间部分-->
                <div class="container">
                    <div class="container-inner panel-group">
                        <!--我的订单-->
                        @if(count($orderService->getOrders($user->id)->toArray()) != 0)
                        <div class="bl-panel panel-head-nobrd">
                            <div class="panel-head">
                                <div class="tit tit-1">
                                    <h3 class="h">我的订单</h3>
                                    <a href="/my/order" class="small link">查看更多</a>
                                </div>
                            </div>
                            <div class="panel-body">
                            <table class="bl-table bl-table-li bl-table-white table-tc order-list">
                                <thead>
                                <tr>
                                    <th class="tl">商品图片</th>
                                    <th class="tl">商品信息</th>
                                    <th>交易金额</th>
                                    <th>订单时间</th>
                                    <th>订单状态</th>
                                    <th>详情</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $orders = $orderService->getOrders($user->id)->take(3) ?>
                                @foreach($orders as $key=>$order)
                                <?php $goodsList=$orderService->getOrderGoods($order->order_id); $goodsCount=$goodsList->count(); ?>
                                @foreach($goodsList as $orderGoodskey=>$orderGoods)
                                <?php $notLast= ($orderGoodskey+1 < $goodsCount); ?>

                                <tr>
                                    <td class="pic tl " style="width:64px;">
                                        <a href="/goods/{{$orderGoods->goods_id}}" target="_blank" title="{{$orderGoods->goods_name}}">
                                            <img class="head-img lazy img-lazyload" data-src="{{$pictureService::thumb($orderGoods->goods_thumb,70,70)}}" alt="#">
                                        </a>

                                        @if($notLast)
                                        <span class="borb"></span>
                                        @endif
                                    </td>
                                    <td class="tl name ui-brd-r">
                                        <p>
                                        <a class="link" href="/goods/{{$orderGoods->goods_id}}" target="_blank" title="{{$orderGoods->goods_name}}">
                                        {{@str_limit($orderGoods->goods_name, 20, '...')}}
                                        </a><br>
                                        <span>×{{$orderGoods->buy_number}}</span>
                                        </p>
                                        @if($notLast)
                                            <span class="borb"></span>
                                        @endif
                                    </td>

                                   @if($orderGoodskey==0)

                                    <td class="ui-brd-r" rowspan="{{$goodsCount}}" style="width: 100px;">
                                        <span>￥{{$order->order_price}}</span><br>

                                    </td>
                                    <td class="ui-brd-r" rowspan="{{$goodsCount}}" style="width: 100px;">
                                        <span class="u-name">{{$order->add_time}} </span>
                                    </td>
                                    <td class="ui-brd-r" rowspan="{{$goodsCount}}" style="width: 100px;">
                                        @if($order->order_status==1)
                                            <span class="text-color-7">
                                            待支付
                                            </span><br>
                                        @elseif($order->order_status==2)
                                            <span class="text-color-7">
                                            待发货
                                            </span><br>
                                        @elseif($order->order_status==3)
                                            <span class="text-color-1">等待收货</span><br>

                                        @elseif($order->order_status==4)
                                            <span class="text-color-7">
                                            已完成
                                            </span><br>
                                        @elseif($order->order_status==5)
                                            <span class="text-color-7">
                                            已取消
                                            </span><br>
                                        @endif
                                    </td>
                                    <td rowspan="{{$goodsCount}}"><a class="link" href="/my/order/{{$order->order_id}}" target="_blank">查看</a></td>
                                   @endif
                                </tr>
                                @endforeach
                                @endforeach
                                </tbody>

                            </table>
                            </div>

                        </div>
                        <!--END/我的订单-->
                        @else
                        <!--我的订单 无数据-->
                        <div class="bl-panel panel-head-nobrd">
                            <div class="panel-head">
                                <div class="tit tit-1">
                                    <h3 class="h">我的订单</h3>
                                </div>
                            </div>
                            <div class="panel-body">
                                <div class="bl-nodata order-nodata">
                                    <div class="nodata-text fn-dib">
                                        <i class="icon icon-nodata icon-nodata-1"></i>
                                        <p class="fn-mb0">您暂时没有订单。</p>
                                        <a href="/">去看看有哪些热门商品 &gt;</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--END/我的订单 无数据-->
                        @endif


                        <!--我收藏的商品-->
                        @if ($request->get('type')=='GOODS'||$request->get('type')=='')
                        @if ($userCollection->count()>0)
                        <div class="bl-panel panel-head-nobrd fav-list">
                            <div class="panel-head">
                                <div class="tit tit-2">
                                    <h3 class="h">
                                        我收藏的商品
                                    </h3>
                                    <a href="/my/collection" class="more">查看更多</a>
                                </div>
                            </div>
                            <div class="panel-body">
                                <ul class="bl-imglist imglist-5col">
                                    @foreach($userCollection->items() as $key=>$collection)
                                    <?php
                                    if($key<5){
                                    $goods = $goodsService->get($collection->reference_id);
                                    if($goods){
                                    ?>
                                    <li>
                                        <a href="/goods/{{$goods->goods_id}}" target="_blank" class="col-space" title="{{$goods->goods_name}}">
                                            <img style="width: 124px;height: 124px;" class="img-lazyload lazy" data-src="{{$pictureService::thumb($goods->goods_thumb,130,130)}}" alt="">
                                            <span class="con">￥{{$goods->shop_price}}</span>
                                        </a>
                                    </li>
                                    <?php } }?>
                                    @endforeach

                                </ul>
                            </div>
                        </div>


                        <!--END/我收藏的商品-->

                        @else
                        <!--我收藏的商品 无数据-->
                        <div class="bl-panel panel-head-nobrd fav-list">
                            <div class="panel-head">
                                <div class="tit tit-2">
                                    <h3 class="h">
                                        我收藏的商品
                                    </h3>
                                    <a href="/my/collection" class="more">查看更多</a>
                                </div>
                            </div>
                            <div class="panel-body">
                                <div class="bl-nodata fav-nodata">
                                    <p class="nodata-text ">
                                        <span class="text-color-1"><a href="/">您还没有收藏任何商品，看到感兴趣的就果断收藏吧！&gt;</a></span>
                                    </p>
                                </div>
                                <?php $similarGoods = $goodsService->getRandomGoods(5);//dd($similarGoods);?>
                                <ul class="bl-imglist imglist-5col">
                                    @if($similarGoods)
                                    @foreach($similarGoods as $key=>$value)
                                    <li>
                                        <a href="/goods/{{$value->goods_id}}" target="_blank" class="col-space"  title="{{$value->goods_name}}">
                                            <img src="@if($value->goods_thumb){{$pictureService->thumb($value->goods_thumb, 200, 200)}} @else # @endif" alt="">
                                            <span class="con">￥{{$value->shop_price}}</span>
                                        </a>
                                    </li>
                                    @endforeach
                                    @endif
                                </ul>
                            </div>
                        </div>
                        @endif
                        @endif

                        <!--END/我收藏的商品 无数据-->



                    </div>
                </div>
                <!--END/内部中间部分-->

            </div>
        </div>
        <!--END/主体部分-->

    </div>
</div>



<!--公共尾部-->

@include('front.common.footer')
        <!--END/公共尾部-->


<!--公用js引用-->
@include('front.common.script')

</body>
</html>